import http from './interface'
import global from '@/utils/global'
import { hideLoading } from '@/utils/helper';
import { useShopStore } from '@/stores/shopStore';
import { useUserStore } from '@/stores/commonStore';
const shopStore = useShopStore();
const userStore = useUserStore();
import {
	env
} from '../env.js';
/**
 * 字符串是否含有html标签的检测中
 */
function checkHtml(htmlStr) {
	var reg = /<[^>]+>/g;
	return reg.test(htmlStr);
}
// 单独导出(测试接口) import {test} from '@/common/vmeitime-http/'
export const request = (config) => {
	//console.log("request请求url和参数：",JSON.stringify(config))
	let contentType = 'application/x-www-form-urlencoded;charset=UTF-8';

	if (config.header)
		contentType = config.header.ContentType
	//设置请求时长
	let sendDate = new Date().getTime();
	let groupTike = getTiket() || ''; //原

	// let groupTike = '483837CE6CFF94E5EB2E999B99782FD52E5DAFCFDA8BF52E26B83C67AB055BD90E0AAFC8192FC8E96135CDBEAC737ECA'
	// let ntiket = uni.getStorageSync(global.USER_TKT)||'';
	// !ntiket&&uni.setStorageSync(global.USER_TKT,groupTike)

	// let groupMemberId = getGlobalUser().groupMemberId || '';
	//请求参数:门店ID(订单列表)
	/* if (config.data)
		config.data.sellerMemberId = global.getSellerMemberId || ''; */

	//设置请求前拦截器
	http.interceptor.request = (content) => {
		content.header = {
			"Content-Type": contentType,
			"tiket": groupTike || '',
			// "Cookie":"8113bf4d616a995dbe086d10019ff5e1",
			"sellerMemberId": shopStore
			.curSellerMemberId, //shopStore.curSellerMemberId优先1扫码入驻,2缓存门店uni.getStorageSync(global.QR_REGISTER_SELL_MEMBERID) ? uni.getStorageSync(global.QR_REGISTER_SELL_MEMBERID) : (uni.getStorageSync(global.SHOP_CURRENT_ID).nmember_id || "1")
		}
	}
	//设置请求结束后拦截器
	http.interceptor.response = (response) => {
		let receiveDate = new Date().getTime();
		let responseTimeMs = receiveDate - sendDate;
		let hasLogin = false; //是否登录标记
		console.log('连接成功服务器响应时长:', response.config.url,responseTimeMs)
		try {
			hasLogin = uni.getStorageSync(global.IS_LOGIN) || false;
		} catch (e) {}

		const regHtml = JSON.stringify(response.data) || '';
		// console.log("regHtmlregHtml:",regHtml)
		const isStepServer = checkHtml(regHtml) ? true : false;
		if (isStepServer && !response.data.result && !(regHtml.indexOf('502') == -1)) {
			hideLoading()
			setTimeout(() => {
				wx.showToast({
					title: '系统正在升级中,请稍后再试哦',
					icon: "none",
				});
				setTimeout(() => {
					wx.hideToast();
				}, 5000)
			}, 0);
			return;
		} else {
			// 登录拦截
			if (response.data && (response.data.code && response.data.code == '-1')) {
				userStore.setUserInfo({})
				uni.removeStorageSync(global.IS_LOGIN);
				uni.setStorageSync(global.USER_TIKET,'');
				//var loginUrl = "pages/login/login/login";
				//防止重复进入登录UI
				//if (loginUrl != prevPage.route) {
				if (!global.CENTER_LOGIN_PAGE) {
					global.CENTER_LOGIN_PAGE = true; //进入登录页面	
					global.IS_FROM_LOGIN = true;
					console.log('进入登录页面+')
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return;
				} else {
					console.log("打印全局页面是否进入：" + global.CENTER_LOGIN_PAGE);
				}
				//}
				/*} */
			}
			//console.log("全局global打印:【"+(config.baseUrl+config.url)+"】请求Url参数："+(JSON.stringify(config.data) || '')+" Url接口Result："+JSON.stringify(response.data) || '')
			return response;
		}
	}
	let formData = {
		baseUrl: config.baseUrl,
		url: config.url,
		dataType: 'json',
		data: config.data,
		method: config.method,
	}
	//console.log("Dev:"+process.env.NODE_ENV+"formData_data:" + JSON.stringify(config.data))
	//responseType
	if (config.responseType) {
		formData.responseType = config.responseType
	}

	//成功请求
	return http.request(formData)
}
export function bindEvent(data) {
	let eventqrId = uni.getStorageSync(global.QR_PARAMS) || {};//QR_NEW_MEAL_EVENT_ID
	if (eventqrId.expiration) {
		if (new Date().getTime() - eventqrId.expiration >= 0) {
			uni.removeStorageSync(global.QR_PARAMS);
		} else {
			eventqrId.shareMemberId||eventqrId.buy_member_id?data.shareMemberId = eventqrId.shareMemberId||eventqrId.buy_member_id||'':'';//暂buy_member_id
			eventqrId.share_id?data.share_id = eventqrId.share_id||'':'';
			data.event_id_1 = eventqrId.event_id_1 || '';
			data.event_id_2 = eventqrId.event_id_2 || '';
		}
	}
	return data
}
export function getGlobalUser() {
	var loginUser = '';
	var globalUser = uni.getStorageSync(global.USER_INFO) || '';
	// console.log("获取全局globalUser:" + globalUser);
	try {
		loginUser = JSON.parse(globalUser);
	} catch (e) {}
	return globalUser ? loginUser : '';
}
// 获取tiket-暂时
export function getTiket() {
	var loginUser = '';
	var globalUser = uni.getStorageSync(global.USER_TIKET) || '';
	return globalUser || '';
}
// 登录-暂
export const login = (data) => {
	return request({
		baseUrl: env.localApi,
		url: '/m/login.do',
		method: 'GET',
		data,
		// handle:true
	})
}
//搜索门店(门店列表)
export const queryMemberList = (data) => {
	return request({
		baseUrl: env.subscribeApi,
		url: '/api/pub/seller/member/query.json',
		// url: '/api/member/queryMemberList.json',
		method: 'POST',
		data
	})
}

//person1-start===>
//获取手机号-登录
export const getWxPhone = (data) => {
	return request({
		baseUrl: env.loginApi,
		url: '/v2/authorize/phone.json',
		method: 'POST',
		data
	})
}
//wxcode-登录
export const getWxCodeLogin = (data) => {
	return request({
		baseUrl: env.loginApi,
		url: '/v2/authorize/login.json',
		method: 'POST',
		data
	})
}
//注册-登录
export const regMemberAct = (data) => {
	let ndata = data || {};
	let params = uni.getStorageSync(global.QR_PARAMS) || {};
	ndata.fromAppId = '11';
	ndata.channel = '1114';
	ndata.systemId = 'S039';
	if (params.expiration) {
		if (new Date().getTime() - params.expiration >= 0) {
			uni.removeStorageSync(global.QR_PARAMS);
		} else {
			ndata.event_id_1 = params.event_id_1 || ''; //事件1
			ndata.event_id_2 = params.event_id_2 || ''; //事件2
			ndata.share_id = params.share_id || '';
			ndata.shareMemberId = params.shareMemberId || ''; //推荐人
			ndata.systemId = params.system_id || 'S039';
			ndata.sellMemberId = params.sellMemberId || '';

		}
	}
	let formData = {
		baseUrl: env.loginApi,
		url: '/v2/authorize/reg.json',
		dataType: 'json',
		data: ndata,
	}
	return request(formData)

}
// 获取活动提示
export const getActiveTags = (data) => {
	// let eventqrId = uni.getStorageSync(global.QR_NEW_MEAL_EVENT_ID) || {};
	// if (eventqrId.expiration) {
	// 	if (new Date().getTime() - eventqrId.expiration >= 0) {
	// 		uni.removeStorageSync(global.QR_NEW_MEAL_EVENT_ID);
	// 	} else {
	// 		data.event_id_1 = eventqrId.event_id_1 || '';
	// 		data.event_id_2 = eventqrId.event_id_2 || '';
	// 	}
	// }
	let ndata = bindEvent(data);
	// data.event_id_1 = '25';
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/activity/bill/tags.json',
		method: 'POST',
		data:ndata
	})
}
//分享参数:保存
export const getSaveShare = (data) => {
	let paramsData = data || {};
	return request({
		baseUrl: env.MemberApi,
		url: 'share/saveShare.json',
		method: 'POST',
		data: paramsData
	})
}
//分享参数:查询分享明细
export const getShareDetail = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'share/details.json',
		method: 'POST',
		data
	})
}
//发送绑定短信
export const sendVeryCode = (data) => {
	data.channelId = '1114';
	return request({
		baseUrl: env.MemberApi,
		url: 'group/member/card/bind/sms/verifcode.json',
		method: 'POST',
		data
	})
}
//绑定电子卡
export const bindCardApi = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'group/member/card/bind.json',
		method: 'POST',
		data
	})
}
//重置电子卡
export const updateCard = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/card/pswd/rest.json',
		method: 'POST',
		data
	})
}
//查询会员的电子卡
export const getCardList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/card/q.json',
		method: 'POST',
		data
	})
}
//解绑电子卡
export const unbindCard = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'group/member/card/unbind.json',
		method: 'POST',
		data
	})
}
//设置默认卡
export const setdfCard = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/card/default.json',
		method: 'POST',
		data
	})
}
//获取会员信息
export const queryMemberDetail = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/info.json',
		method: 'POST',
		data
	})
}
//获取电子卡流水
export const getCardPayList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/card/pays/list.json',
		method: 'POST',
		data
	})
}
//获取视频直播
export const getVideoLive = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/member/CameraUrl/get.json',
		method: 'POST',
		data
	})
}
//购物车列表
export const getCartList = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/list.json',
		method: 'POST',
		data
	})
}
//修改购物车数量
export const editCart = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/edit.json',
		method: 'POST',
		data
	})
}
//清空购物车
export const clearCart = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/clear.json',
		method: 'POST',
		data
	})
}
//选择商品-购物车（暂无用）
export const selectCartItem = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/select.json',
		method: 'POST',
		data
	})
}
//修改配送方式-购物车（暂无用）
export const changeServiceType = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/service/change.json',
		method: 'POST',
		data
	})
}

//购物车总数
export const getCartNums = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/nums.json',
		method: 'POST',
		data
	})
}
//确认订单
export const confirmCart = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/confirm.json',
		method: 'POST',
		data
	})
}
//运费计算
export const deliveryCalc = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/delivery/price/computer.json',
		method: 'POST',
		data
	})
}

//我的订单
export const getorderData = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/list.json',
		method: 'POST',
		data
	})
}
//我的订单 退款
export const getorderRefundData = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/back_list.json',
		method: 'POST',
		data
	})
}
//取消订单
export const getCancelorder = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/unpay/cancel.json',
		method: 'POST',
		data
	})
}
//删除订单  
export const getremoveOrder = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/remove.json',
		method: 'POST',
		data
	})
}
//修改订单地址
export const getEditOrder = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/address.json',
		method: 'POST',
		data
	})
}
//退款
export const getRefund = (data) => {
	return request({
    header: {
    	ContentType: 'application/json'
    },
		baseUrl: env.TradeApi,
		// url: '/api/bill/billback.json',
    url: '/api/bill/billback_v2.json',
		method: 'POST',
		data
	})
}
//评价订单详情  
export const orderEvaluate = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/getBillGoodList.json',
		method: 'POST',
		data
	})
}
//评价置顶
export const topRating = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/getIsTop.json',
		method: 'POST',
		data
	})
}
//我的评价
export const getmyEvaluation = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/tabulation.json',
		method: 'POST',
		data
	})
}
//删除我的评价
export const evaluateDele = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goodsDiscuss/delete.json',
		method: 'POST',
		data
	})
}
//菜品评价详情  
export const varietyEvaluate = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/getGoodsInfo.json',
		method: 'POST',
		data
	})
}
//菜品点赞
export const agreeWith = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/modifyGoodsReport.json',
		method: 'POST',
		data
	})
}
//获取菜品是否点赞
export const getLikeStatus = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/getGoodsDiscussState.json',
		method: 'POST',
		data
	})
}
//点赞  踩
export const getlikeorStepon = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goodsDiscussFlows/modify.json',
		method: 'POST',
		data
	})
}
//置顶评论是否点赞 
export const getTopComment = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goodsDiscussFlows/get.json',
		method: 'POST',
		data
	})
}
//评论详情
export const getCommentdetails = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/getGoodDetailInfo.json',
		method: 'POST',
		data
	})
}
// 提交评论
export const submitomment = (data) => {
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/save.json',
		method: 'POST',
		data
	})
}
//查询评论标签
export const getqueryDiscussLabel = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/queryDiscussLabel.json',
		method: 'GET',
		data
	})
}
//查询首页特价菜品
export const getSpecialFood = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getTeMaiGoodsList.json',
		method: 'GET',
		data
	})
}
//会员虚拟商品充值商品列表
export const queryShopRechargeList = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/goods/recharge/list.json',
		method: 'POST',
		data
	})
}
//获取B2C创建充值订单
export const createRechargeOrder = (data) => {
	let eventqrId = uni.getStorageSync(global.QR_NEW_MEAL_EVENT_ID) || {};
	if (eventqrId.expiration) {
		if (new Date().getTime() - eventqrId.expiration >= 0) {
			uni.removeStorageSync(global.QR_NEW_MEAL_EVENT_ID);
		} else {
			data.event_id_1 = eventqrId.event_id_1 || '';
			data.event_id_2 = eventqrId.event_id_2 || '';
		}
	}
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/process/cz.json',
		data,
	})
}

//充值开卡提交
export const submitOpenVip = (data) => {
	let ndata = bindEvent(data);
	// let eventqrId = uni.getStorageSync(global.QR_NEW_MEAL_EVENT_ID) || {};
	// if (eventqrId.expiration) {
	// 	if (new Date().getTime() - eventqrId.expiration >= 0) {
	// 		uni.removeStorageSync(global.QR_NEW_MEAL_EVENT_ID);
	// 	} else {
	// 		data.event_id_1 = eventqrId.event_id_1 || '';
	// 		data.event_id_2 = eventqrId.event_id_2 || '';
	// 	}
	// }
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/process/kk.json',
		method: 'POST',
		data:ndata
	})
}

// 提交订单
export const submitOrder = (data) => {
	let ndata = bindEvent(data);
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/process.json',
		method: 'POST',
		data:ndata
	})
}
// 立即购买-随心配-多套
export const submitBuyingNow = (data) => {
	let ndata = bindEvent(data);
	return request({
		// header: {
		// 	ContentType: 'application/json'
		// },
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/confirm/sxp.json',
		method: 'POST',
		data:ndata
	})
}
// 立即购买-随心配-周期约餐
export const submitBuyingMealsNow = (data) => {
	let ndata = bindEvent(data);
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/dynamic/now.json',
		method: 'POST',
		data:ndata
	})
}
// 检查订单支付状态
export const checkOrderStatu = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/state.json',
		data
	})
}
//券数量查询-添加优先选券规则
export const getAutoCoupon = (data) => {
	data.channel = '1114';
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/member/usable/auto-choice.json',
		method: 'POST',
		data,
	})
}
//我的专区劵查询
export const cred_list = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/cred/list.json',
		method: 'POST',
		data,
	})
}

//資格劵詳情
export const cred_list_infos = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/cred/info.json',
		method: 'post',
		data,
	})
}
//是否领劵资格 
export const coupons_qualifications = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/cred/share/verif.json',
		method: 'post',
		data,
	})
}

//专区劵分享详情
export const shareinfo = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/cred/share/info.json',
		method: 'post',
		data,
	})
}

//分享有礼
export const shareinfoGift = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/share/shareQrUrl.json',
		responseType: 'arraybuffer',
		method: 'post',
		data,
	})
}
//领取专区劵
export const sharegif = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/cred/gif.json',
		method: 'post',
		data,
	})
}

//会员专区劵账户
export const getCredAccount = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/cred/account.json',
		data,
	})
}

//代金券列表查询
export const usableCouponList = (data) => {
	data.channel = '1114';
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/member/usable.json',
		method: 'POST',
		data
	})
}

//会员资格劵账户
export const getVipAccount = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/money/vip.json',
		method: 'post',
		data
	})
}
//我的代金券总数  
export const totalCouponAmount = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/coupon/count.json',
		data,
	})
}
//门店资料
export const memberCompany = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/company.json',
		data,
	})
}
//识别地址
export const identifyAddressData = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/identifyAddress.json',
		data,
	})
}
//电子卡支付
export const takeCardPay = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/group/pay/go.json',
		data,
	})
}
// 结算-微信支付
export const wx_Payment = (data) => {
	return request({
		baseUrl: env.wxPayApi,
		url: '/unionpay/wx/trade/order.do',
		data,
		// handle:true
	})
}
//支付状态
export const getOrderStatus = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/get.json',
		data,
	})
}
//获取定位距离
export const queryDistance = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/queryMapLbs.json',
		method: 'POST',
		data,
		// handle:true
	})
}
//加入购物车-套餐
export const addMealCart = (data) => {
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/dynamic/add.json',
		method: 'POST',
		data,
	})
}
//编辑购物车-套餐
export const editMealCart = (data) => {
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/dynamic/edit.json',
		method: 'POST',
		data,
	})
}
//person1-end




//person2-start===>
//加入购物车
export const shopcartAdd = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/add.json',
		method: 'POST',
		data,
	})
}
//购物车删除
export const shopcartDel = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/del.json',
		method: 'POST',
		data,
	})
}
//销售分类
export const shopcartDdxGoods = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/sellerCategory/getTree.json',
		method: 'get',
		data,
	})
}
//商品分类
// 2024-11-6 修改接口 原接口:/api/ddx/goods/getCategoryAndGoodList.json,新:/api/goods/list.json
export const dxGoodsDetial = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/goods/list.json',
		method: 'get',
		data,
	})
}

export const addVipGood = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/api/shopcart/add/vip.json',
		method: 'post',
		data
	})
}
//我的券列表
export const getCouponList = (data) => {
	// data.channel = '1114';
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/member/list.json',
		method: 'post',
		data
	})
}
//保存发票
export const saveInvoice = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/ddx/saveInvoice.json',
		method: 'post',
		data
	})
}
//发票列表
export const queryInvoice = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/ddx/queryInvoice.json',
		method: 'post',
		data
	})
}
//发票列表
export const searchInfobyId = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/ddx/infoInvoice.json',
		method: 'post',
		data
	})
}
//批量发送发票
export const batchInvoice = (data) => {
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.TradeApi,
		url: '/api/ddx/batchInvoice.json',
		method: 'post',
		data
	})
}
//商品详情
export const getGoodDetail = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getGoodDetail.json',
		method: 'post',
		data
	})
}
//多套餐已开卡列表
export const getMealsOrder = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/card/list.json',
		method: 'post',
		data
	})
}
//查询随心配多套餐明细
export const getMealsGoodDetail = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/d/detail.json',
		method: 'post',
		data
	})
}
//随心配多套日历查询订单明细
export const getCalDetail = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/n/detail.json',
		method: 'post',
		data
	})
}
//随心配多套查询商品能量总和
export const getMealsTotalNl = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/n/all.json',
		method: 'post',
		data
	})
}


//查询多套餐段
export const getMealsSec = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/d/rt.json',
		method: 'post',
		data
	})
}

//查询随心配多套餐日期列表
export const getMealDate = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/d/date.json',
		method: 'post',
		data
	})
}
//随心配多套取消订单
export const cancelMeals = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/y/c.json',
		method: 'post',
		data
	})
}
//随心配设置
export const doMealsSet = (data) => {
	return request({
		header: {
			ContentType: 'application/json'
		},
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/y/e.json',
		method: 'post',
		data
	})
}
//随心配-获取周配置列表
export const getMealsWeeks = (data,type='') => {
	let nurl = type == 'appionted'?'/api/ddx/goods/d/qdate.json':'/api/ddx/goods/d/bdate.json'
	return request({
		baseUrl: env.GoodsApi,
		url: nurl,
		method: 'post',
		data
	})
}

//随心配设置-查询
export const getMealsSet = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/y/q.json',
		method: 'post',
		data
	})
}

//退款订单明细
export const getRefundBillData = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/getRefundBill.json',
		method: 'post',
		data
	})
}
//退款原因
export const getRefundReasona = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/billback/cause.json',
		method: 'post',
		data
	})
}
//反馈
export const complainSave = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/ddx/complain/save.json',
		method: 'post',
		data
	})
}
//评论列表  更换接口/api/ddx/goods/goodsDiscuss/list.json
export const goodsDiscuss = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/goodsDiscuss/commentList.json',  
		method: 'post',
		data
	})
}
//查询商品是否喜欢
export const isShopFavi = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/getMemberGoodsByGoodsId.json',
		method: 'post',
		data
	})
}
//商品喜欢、不喜欢
export const setLikes = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/setLikes.json',
		method: 'post',
		data
	})
}
//直播
export const cameraList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'camera/list.json',
		method: 'post',
		data
	})
}
//订单详情
export const billDetail = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/detail.json',
		method: 'post',
		data
	})
}
//订单详情 退款
export const billDetailRefund = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/paid/cancel.json',
		method: 'post',
		data
	})
}
//首页-大家都在吃
export const getGoodsLikeList = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getGoodsLikeList.json',
		method: 'post',
		data
	})
}
//首页-轮播图
export const getTemplate = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/ddx/trade/index/getTemplate.json',
		method: 'post',
		data
	})
}
//点餐-获取预定时间
export const getDateList = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getDateList.json',
		method: 'get',
		data
	})
}
//点餐-获取预定时间-多套约餐
export const getMealDateList = (data,type) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/o/tlist.json',
		method: 'get',
		data
	})
}
//提交订单-获取预定时间
export const getCheckDateList = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getCheckDateList.json',
		method: 'get',
		data
	})
}
//点餐-我喜欢的
export const getMyLikeGoodsList = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/getMyLikeGoodsList.json',
		method: 'get',
		data
	})
}
//设置-详情
export const queryMemberInfo = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/queryMemberInfo.json',
		method: 'post',
		data
	})
}
//设置-保存设置
export const updateMember = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/updateMember.json',
		method: 'post',
		data
	})
}
//点餐-获取当前门店配送方式
export const getMemberInfo = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/getMemberInfo.json',
		method: 'post',
		data
	})
}
//点餐-辣不辣标签
export const queryLabelListByGoodsIdn = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/queryLabelListByGoodsId.json',
		method: 'get',
		data
	})
}
//点餐-促销活动(满减)
export const queryMenuPromotion = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/activity/promotion.json',
		method: 'post',
		data
	})
}
//点餐-促销活动(代金券)
export const queryMenuPromotionList = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/list.json',
		method: 'get',
		data
	})
}
//订单详情-营养成分
export const queryNutrients = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/queryNutrients.json',
		method: 'get',
		data
	})
}
//领券
export const memberGet = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/api/coupon/member/get.json',
		method: 'post',
		data
	})
}
//查询领券状态-领券
export const memberGetStatu = (data) => {
	return request({
		baseUrl: env.ShopCartApi,
		url: '/state.json',
		method: 'post',
		data
	})
}

//获取专题范围 - 专题模板
export const getSpecialScopes = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/activity/spec/get.json',
		method: 'post',
		data,
		// handle:true
	})
}

//搜索门店(活动-专题模板)
export const modifyScopeShopDetails = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/queryActivityMemberList.json',
		method: 'POST',
		data
	})
}
//获取专题详情 - 专题模板
export const getSpecialDetails = (data) => {
	return request({
		baseUrl: env.ActivityApi,
		url: '/activity/special/id.json', //spec/id.json
		method: 'POST',
		data,
		// handle:true
	})
}
// 商品搜索
export const getSearch = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/ddx/goods/search.json',
		method: 'get',
		data
	})
}

//套餐流水
export const getFlows = (data) => {
	return request({
		baseUrl: env.TradeApi,
		url: '/api/bill/sxpd/flows.json',
		method: 'get',
		data
	})
}
// 商品详情-(介绍、食材、检测)
export const getDetailExtend = (data) => {
	return request({
		baseUrl: env.GoodsApi,
		url: '/api/goods/detail/extend.json',
		method: 'get',
		data
	})
}

//person2-end



//person3-start===>

//person3-end

//门店列表
export const getStoreList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/queryMemberList.json',
		method: 'POST',
		data,
	})
}
//常去的门店
export const getLastTimeMd = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/queryLastMemberList.json',
		method: 'GET',
		data,
	})
}
//关注的门店列表
export const getFollowStoreList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/queryMerberGoodsFollow.json',
		method: 'POST',
		data,
	})
}

//收藏门店
export const collectStore = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/memberGoods/save.json',
		method: 'POST',
		data
	})
}
//取消收藏门店
export const cancelCollectStore = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/memberGoods/delete.json',
		method: 'POST',
		data
	})
}
//门店详情
export const cancelCollectdetails = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/company.json',
		method: 'POST',
		data
	})
}

//查询商品、门店、会员的关注状态，类型339：商品，340：活动，835：门店 -	会员关注
export const getMemberGoodsByObjectId = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'member/getMemberGoodsByObjectId.json',
		method: 'POST',
		data,
		// handle:true
	})
}
//地址列表
export const getAddressList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/address/q.json', //  ddx/address/q.json
		method: 'POST',
		data,
	})
}
//添加地址
export const getsaveAddressList = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/saveAddress.json',
		method: 'POST',
		data,
	})
}

//删除地址
export const getdeleteAddress = (data) => {
	return request({
		baseUrl: env.MemberApi,
		url: 'ddx/deleteAddress.json',
		method: 'POST',
		data,
	})
}


// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	queryMemberList,
	getWxPhone, //获取手机号-登录
	getWxCodeLogin, //wxcode-登录
	regMemberAct, //注册-登录
	getSaveShare, //分享参数:保存
	getActiveTags, // 获取活动提示
	getShareDetail, //分享参数:查询分享明细
	sendVeryCode, //发送绑定短信
	bindCardApi, //绑定电子卡
	getCardList, //查询会员的电子卡
	unbindCard, //解绑电子卡
	setdfCard, //设置默认卡
	queryMemberDetail, //获取会员信息
	getCardPayList, //获取电子卡流水
	addMealCart,//加入购物车-套餐
	editMealCart,//编辑购物车-套餐
	shopcartAdd, //加入购物车
	getCartList, //购物车列表
	editCart, //修改购物车数量
	clearCart, //清空购物车
	selectCartItem, //选择商品-购物车（暂无用）
	changeServiceType, //修改配送方式-购物车（暂无用）
	getCartNums, //购物车总数
	confirmCart, //确认订单
	deliveryCalc, //运费计算
	submitOrder, // 提交订单
	submitBuyingNow,// 立即购买
	submitBuyingMealsNow,//立即购买-多套
	submitOpenVip,//开卡
	createRechargeOrder,//获取B2C创建充值订单
	getAutoCoupon,
	usableCouponList,
	getVipAccount,
	checkOrderStatu,
	shopcartDel,
	shopcartDdxGoods,
	dxGoodsDetial,
	getAddressList, //地址列表
	getFollowStoreList, //关注的门店列表
	getStoreList, //门店列表
	getsaveAddressList, //添加地址
	getdeleteAddress, //删除地址
	cred_list, //我的专区劵查询
	addVipGood,
	cred_list_infos, //資格劵詳情
	coupons_qualifications, //是否领劵资格
	shareinfo, //专区劵分享详情
	sharegif, //领取专区劵
	getCredAccount, //专区券信息
	getCouponList,
	totalCouponAmount, //我的代金券总数
	memberCompany, //门店资料
	collectStore, //收藏
	cancelCollectStore, // 取消收藏
	getMemberGoodsByObjectId,
	saveInvoice,
	queryInvoice,
	searchInfobyId,
	batchInvoice,
	getGoodDetail,
	getMealsGoodDetail,
	getMealsOrder,//多套餐已开卡列表
	getMealsTotalNl,
	getCalDetail,
	getMealsSec,
	getMealDate,
	cancelMeals,
	doMealsSet,//随心配设置
	getMealsWeeks,
	getMealsSet,//随心配设置-查询
	complainSave,
	goodsDiscuss,
	isShopFavi,
	setLikes,
	cancelCollectdetails, //门店详情
	identifyAddressData, //识别地址
	takeCardPay,
	wx_Payment,
	getOrderStatus,
	cameraList,
	getorderData, //我的订单
  getorderRefundData, //我的订单 退款
	getCancelorder, //取消订单
	getremoveOrder, //删除订单
	getEditOrder, //修改订单地址 
	getRefund, //退款
	billDetail,
	getGoodsLikeList,
	orderEvaluate, //评分订单详情
	submitomment, //保存评论
	getqueryDiscussLabel, //查询评论标签
	queryDistance,
	getTemplate,
	getDateList,
	getMealDateList,
	getRefundBillData, //退款订单明细
	getRefundReasona, //退款原因
	varietyEvaluate, //菜品评价详情
	getMyLikeGoodsList,
	agreeWith, //菜品点赞
	shareinfoGift, //分享有礼
	getLikeStatus, //商品评论详情是否点赞
	queryMemberInfo,
	updateMember,
	topRating, //评价置顶
	getTopComment, // 置顶评论是否点赞   
	getlikeorStepon, //点赞和踩
	getCommentdetails, //评论详情
	getMemberInfo,
	queryLabelListByGoodsIdn,
	getCheckDateList,
	getSpecialFood, //查询特价菜品
	queryMenuPromotionList,
	queryMenuPromotion,
	queryShopRechargeList, //会员虚拟商品充值商品列表
	queryNutrients,
	memberGetStatu,
	memberGet,
  getLastTimeMd, //上一次去的门店
  updateCard, //重置电子卡密码
  getVideoLive, //获取视频直播
  billDetailRefund, //订单详情退款
  getmyEvaluation, //我的评价
  evaluateDele, //删除我的评价
	getSpecialScopes,
	modifyScopeShopDetails,
	getSpecialDetails,
	getSearch,
	getFlows,
	getDetailExtend
}